# encoding: utf-8

require 'paper_house'

libhello = PaperHouse::SharedLibraryTask.new :libhello do | task |
  task.library_name = 'hello'
  task.version = '0.1.0'
  task.target_directory = 'objects'
  task.sources = 'sources/hello.c'
  task.includes = 'includes'
  task.cflags = %w(-Werror -Wall -Wextra)
end

task hello: [:libhello, libhello.linker_name, libhello.soname]

PaperHouse::ExecutableTask.new :hello do | task |
  task.sources = 'sources/main.c'
  task.includes = 'includes'
  task.ldflags = '-L.'
end

[libhello.linker_name, libhello.soname].each do | each |
  file each do | task |
    symlink File.join('objects', libhello.target_file_name), task.name
  end

  CLOBBER.include each if FileTest.exists?(each)
end
